/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.swirrel.listener;

import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import org.swirrel.util.MethodCall;
import org.swirrel.util.SwirrelException;

/**
 *
 * @author Gronau
 */
public class SwirrelCaretListener extends AbstractSwirrelListener implements CaretListener {

    private final MethodCall caretUpdateCall;

    public SwirrelCaretListener(MethodCall caretUpdateCall) {
        this.caretUpdateCall = caretUpdateCall;
        if(! checkSignature(caretUpdateCall, CaretEvent.class)) {
            throw new SwirrelException("Method must have none or one CaretEvent argument");
        }
    }

    public void caretUpdate(CaretEvent e) {
        call(caretUpdateCall, e);
    }
}